const { defineConfig } = require('@vue/cli-service')
const Mock = require("mockjs")
const data = Mock.mock({
  "list|10":[{
    "name":"@cname",
    "img":"@Image(50x50,@color)",
    "info":"@ctitle(5,10)"
  }]
})
module.exports = defineConfig({
  transpileDependencies: true,
  devServer:{
    onBeforeSetupMiddleware({app}){
        app.get("/list",(req,res)=>{
             res.send(data.list)
        })
        app.get("/login1",(req,res)=>{
             console.log(req.query);
              if (req.query.username == "13935716291" && req.query.password == "123456") {
                res.send({
                  code:1,
                  msg:"登陆成功"
                })
              } else {
                res.send({
                  code:0,
                  msg:"用户名密码错误"
                })
              }
        })
    }   
  }
})
